Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to require, loadlib and UdpServer #396

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Fixes to require, loadlib and UdpServer #396

wants to merge 6 commits into from

Conversation

Dregu
Copy link
Collaborator

@Dregu Dregu commented Sep 11, 2024

It was recently brought back to my attention that loading DLLs with require simply didn't work at all, and loadlib could only load them from the game root.

  • Fixed loading DLLs with require from the mod folder
  • Fixed loading DLLs with package.loadlib from the mod folder
  • Fixed silly 3rd party scripts using require on built-in libraries just setting them to nil
  • Added UdpServer:close() (and garbage collection by nil) to close servers
  • Added UdpServer:open() and UdpServer:error() to check what went wrong

This should allow things like the archipelago mod to simply require "apclientpp" when apclientpp.dll is vendored with the mod, instead of all the extra steps when installing it.

The following also seem to work for example, when a complete luasocket build is provided to the mod dir:

-- Loads socket.lua, which later requires the actual core.dll with require("socket.core"), which all seems to work out
local socket = require("socket")
local mime = package.loadlib("mime/core.dll", "luaopen_mime_core")()

@Dregu Dregu changed the title Fixes to require and loadlib Fixes to require, loadlib and UdpServer Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant